<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    response.setHeader("cache-control","public");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<!-- 创建考试第一步 -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>在线考试系统</title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/font/font-awesome.min.css">
    <link rel="stylesheet" href="<%=path%>/static/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/examMng/core.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/examMng/exam-org-deta.css"/>
    <link rel="stylesheet" href="<%=path%>/static/css/examMng/exam-org.css"/>
    <link type="text/css" href="<%=path%>/static/css/examMng/jquery-ui-1.8.17.custom.css" rel="stylesheet"/>
    <link type="text/css" href="<%=path%>/static/css/examMng/jquery-ui-timepicker-addon.css" rel="stylesheet"/>
    <link rel="stylesheet" href="<%=path%>/static/css/ztree/zTreeStyle.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/bootstrap-table.css">
    <!--bootstrap基础引用 start-->

    <script type="text/javascript" src="<%=path%>/static/jstreeview/bootstrap/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="<%=path%>/static/js/bootstrap.min.js"></script>
	<!--bootstrap基础引用 end-->
	<!--bootstrap-dialog start-->
	<link rel="stylesheet" type="text/css" href="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.css">
	<script type="text/javascript" src="<%=path%>/static/jstreeview/plugins/bootstrap-dialog/bootstrap-dialog.min.js"></script>
	<!--bootstrap-dialog end-->
    <style type="text/css">
        #table input {
            height: 37px;
        }

        .fixed-table-toolbar input {
            height: 40px;
        }

        .fixed-table-toolbar button {
            height: 40px;
        }

        .page-list button {
            height: 40px;
        }

        #table > tbody > tr {
            border-top: 1px solid #ccc;
        }
        .div-answer {
            line-height:2em;
        }
        .div-title {
            line-height:3em;
            font-size:20px;
        }

        .div-pic {
            float: left;
            margin-right: 20px;
        }
    </style>

    <script src="<%=path%>/static/js/respond.js"></script>

    <!--[if !IE]> -->
    <script type="text/javascript">
        window.jQuery || document.write("<script src='<%=path%>/static/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
    </script>
    <!-- <![endif]-->
    <script type="text/javascript">
        window.jQuery || document.write("<script src='<%=path%>/static/js/jquery-1.9.1.min.js'>" + "<" + "/script>");
    </script>
</head>

<jsp:include page="../head.jsp" flush="true"/>
<div class="main-container albox-pad-top padingtop0">
    <div class="panel container body-box">
        <div class="panel-heading col-lg-12 col-md-12  top-brgclr" style="height: 70px; background: #4c4ca6;">
            <c:choose>
                <c:when test="${label eq 'edit' }">
                    <p class=" col-lg-10 col-md-10 col-sm-10 color-fff">编辑考试</p>
                </c:when>
                <c:otherwise>
                    <p class=" col-lg-10 col-md-10 col-sm-10 color-fff">新增考试</p>
                </c:otherwise>
            </c:choose>

            <a class="color-fff floatrit aahover fontweight400" href="<%=path%>/exam/toExamList"><span
                    class="glyphicon glyphicon-arrow-left "></span> 返回</a>
        </div>
        <div class="panel-body minheight" >
            <div class="center1 row">
                <div class="cirle0 stypebox1 ">
                    1
                </div>
                <div  class="line-blue1 stype1 "></div>
                <div  class="line-blue2 stype2 "></div>
                <div class="cirle1 stype2 stypebox2">
                    2
                </div>
                <div  class="line-blue2 stype2 "></div>
                <div  class="line-blue3 stype3 "></div>
                <div class="cirle1 stype3 stypebox3">
                    3
                </div>
                <div class="line-blue3 stype3"></div>
                <div class="line-blue4 stype4"></div>
                <div id=" " class="cirle1 stype4 stypebox4">
                    4
                </div>
            </div>
            <div class="describe-info">
                <p class="col-lg-3 col-md-3 col-sm-3 describe-info-p0">考试基本信息</p>
                <p class="col-lg-3 col-md-3 col-sm-3 describe-info-p1 stypep2">试卷配置</p>
                <p class="col-lg-3 col-md-3 col-sm-3 describe-info-p2 stypep3">人员选择</p>
                <p class="col-lg-3 col-md-3 col-sm-3 describe-info-p3 stypep4">发布考试</p>
            </div>
            <div class=" borderbottom">
            </div>

            <!--
                作者：306794978@qq.com
                时间：2016-06-22
                描述：第一步开始
            -->
            <div id="stypediv1" class="form-box col-lg-12 col-md-12 col-sm-12 stype1displaynone2"
                 style="min-height:300px;">
                <form id="firtStep" action="<%=basePath %>exam/addExamFirstStep" type="POST"
                      class="form-inline col-lg-12 col-md-12 col-sm-12">
                    <div class="form-group col-lg-12 col-md-12 col-sm-12 padding-0">
                        <div class="input-group-box col-lg-12 col-md-12 col-sm-12">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12">
                                <div class="input-group-addon width150">考试名称</div>
                                <input type="hidden" id="examId" name="examId" value="${examId}">
                                <c:choose>
                                    <c:when test="${label eq 'edit' }">
                                        <input name="title" id="text1" type="text" class="form-control"
                                               value="${examName}" maxlength="100"/>
                                    </c:when>
                                    <c:otherwise>
                                        <input name="title" id="text1" type="text" class="form-control" value=""
                                               placeholder="请输入考试名称" maxlength="100"/>
                                    </c:otherwise>
                                </c:choose>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-4 col-md-4 col-sm-4">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">考试大类</div>
                                <select id="type" name="type" class="form-control" >
                                    <option value="0">请选择考试大类</option>
                                    <c:forEach items="${typeList}" var="type">
                                        <option value="${type.id }"
                                                <c:if test="${label eq 'edit'&& type.id eq typeId }">selected</c:if>>${type.name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-4 col-md-4 col-sm-4">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">专业</div>
                                <select id="pro" name="pro" class="form-control" 
                                        onclick="change();">
                                    <option value="0">请选择专业</option>
                                    <c:forEach items="${proList }" var="pro">
                                        <option value="${pro.id }"
                                                <c:if test="${label eq 'edit'&& pro.id eq proId }">selected</c:if>>${pro.name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-4 col-md-4 col-sm-4">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">级别</div>
                                <select id="rank" name="rank" class="form-control" >
                                    <option value="0">请选择级别</option>
                                    <c:if test="${label eq 'edit' }">
                                        <c:forEach items="${rankList }" var="ranks">
                                            <option value="${ranks.id }"
                                                    <c:if test="${label eq 'edit'&& ranks.id eq rankId }">selected</c:if>>${ranks.name }</option>
                                        </c:forEach>
                                    </c:if>
                                </select>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12">
                                <div class="input-group-addon width150">开考时间</div>
                                <c:choose>
                                    <c:when test="${label eq 'edit' }">
                                        <input name="starttime" type="text" id="ui_timepicker"
                                               class="ui_timepicker form-control" value="${starttime }"/>
                                    </c:when>
                                    <c:otherwise>
                                        <input name="starttime" type="text" id="ui_timepicker"
                                               class="ui_timepicker form-control" value=""/>
                                    </c:otherwise>
                                </c:choose>


                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">考试时长</div>

                                <c:choose>
                                    <c:when test="${label eq 'edit' }">
                                        <input id="cuntverify" name="duration" type="text" class="form-control "
                                               value="${duration }" maxlength="3" placeholder=""/>
                                    </c:when>
                                    <c:otherwise>
                                        <input id="cuntverify" name="duration" type="text" class="form-control "
                                               value="" maxlength="3" placeholder="请设置考试时长"/>
                                    </c:otherwise>
                                </c:choose>
                                <div class="input-group-addon borderleftnone">分钟</div>

                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">试题打乱</div>
                                <select name="questionrandom" class="form-control" >

                                    <option value="1"
                                            <c:if test="${label eq 'edit'&&questionRandom eq '1' }">selected</c:if>>是
                                    </option>
                                    <option value="0"
                                            <c:if test="${label eq 'edit'&&questionRandom eq '0' }">selected</c:if>>否
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12 uptime">
                                <div class="input-group-addon width150">选项打乱</div>
                                <select name="optionrandom" class="form-control" >
                                    <option value="1"
                                            <c:if test="${label eq 'edit'&&optionRandom eq '1' }">selected</c:if>>是
                                    </option>
                                    <option value="0"
                                            <c:if test="${label eq 'edit'&&optionRandom eq '0' }">selected</c:if>>否
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="input-group-box col-lg-12 col-md-12 col-sm-12">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12">
                                <div class="input-group-addon width150">考试地点</div>

                                <c:choose>
                                    <c:when test="${label eq 'edit' }">
                                        <input name="address" id="text3" type="text" class="form-control"
                                               value="${address }" maxlength="50"/>
                                    </c:when>
                                    <c:otherwise>
                                        <input name="address" id="text3" type="text" class="form-control" value=""
                                               placeholder="请输入考试地点" maxlength="50"/>
                                    </c:otherwise>
                                </c:choose>

                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12">
                                <div class="input-group-addon width150">考试组织</div>
                                <input name="creater" type="text" class="form-control" value="${userInfo.name }"
                                       placeholder="" readonly/>

                            </div>
                        </div>
                        <div class="input-group-box col-lg-6 col-md-6 col-sm-6">
                            <div class="input-group col-lg-12 col-md-12 col-sm-12">
                                <div class="input-group-addon width150">所在单位</div>
                                <input name="unit" type="text" class="form-control" value="${unit.name }" placeholder=""
                                       readonly/>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <!--
                作者：306794978@qq.com
                时间：2016-06-22
                描述：第一步结束
            -->
            <!--
                作者：306794978@qq.com
                时间：2016-06-22
                描述：第二步开始
            -->
            <div id="stypediv2" class="dpynone stype2cls">
                <table id="table"></table>
            </div>
            <!--
                作者：306794978@qq.com
                时间：2016-06-22
                描述：第二步结束
            -->
            <!--
                作者：306794978@qq.com
                时间：2016-06-23
                描述：第三步开始---------------ztree--代码在exam-org-add-exam.js
            -->
            <div id="stypediv3" class="dpynone col-lg-12 col-md-12">
                <div class="col-lg-4 col-md-4 divleft-box">
                    <div class="divleft">
                        <div class="ztree-top">
                            单位选择
                        </div>
                        <div class="ztree-box">
                            <ul id="treeDemo" class="ztree"></ul>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 divmiddle-box">
                    <div class="divtopleft current">
                        人员选择
                    </div>
                    <div class=" divmiddle">
                        <ul id="kaosheng" class="ul-left">
                        </ul>
                    </div>
                </div>
                <div id="" class="col-lg-4 col-md-4 lastdiv-box">
                    <div class="divlast-top current col-lg-5 col-md-5">
                        选中人员
                    </div>
                    <div id="choosepeople" class="col-lg-4 col-md-4  text-center">
                        选中　<span class="colorgreen">0</span>　人
                    </div>
                    <div id="allchoosedel" class="allchoose btn btn-primary  col-lg-4 col-md-4 ">
                        重置
                    </div>
                    <div class="divlast">
                        <ul id="add-del">
                            <c:forEach items="${studentList}" var="student" varStatus="status">
                                <li data-toggle="tooltip" data-placement="bottom"  id="${student.studentid}" class="li-add-del">
                                    <span class="floatleft spfirst">${student.name} </span>
                                    <span onclick="delpolice(this)" class="glyphicon glyphicon-minus-sign colordel floatrit"></span>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
            <!--
                作者：306794978@qq.com
                时间：2016-06-23
                描述：第三步结束--------------ztree--代码在exam-org-add-exam.js
            -->
            <!--
                作者：306794978@qq.com
                时间：2016-06-27
                描述：第四步开始--------------
            -->
            <div id="stypediv4" class="dpynone">
                <p class="colorblue text-center fontsize16"><span id="examName"></span> <span
                        class="clor-red">信息确认</span></p>
                <div class="tishi-info tishibrg ">
                    <div class="img-box">
                        <img class="" src="<%=path%>/static/images/examMng/examorg-addexam.png"/>
                    </div>

                    <p class="p-tishiinfo ">
                        请仔细确认下列信息是否准确无误！若正确请点击下方“确认发布”按钮，系统会将本场考试信息公布，
                        <span class="clor-red">注意：此操作无法撤回；</span> 若发现错误信息，请点击上一步按钮返回继续修改后再行发布！
                    </p>
                </div>

                <div class=" padding-left-ringt30 padding-0">
                    <p class="p-font-weight col-lg-12 col-md-12 col-sm-12 padding-20-0-5 ">考试组织：</p>
                    <div class="bdr col-lg-12 col-md-12 col-sm-12 padding-right-0">
                        <div class="examorg-left col-lg-10 col-md-10 col-sm-10">
                            <p class="p1-info col-lg-12 col-md-12 col-sm-12">
                                考试状态：
                                <span id="publish" class="sp-clr-red"></span>
                            </p>

                            <p class="col-lg-7 col-md-7 col-sm-7 p-info">考试时间：
                                <span id="starttime" class="sp-clr-blue"></span>
                            </p>
                            <p class="col-lg-5 col-md-5 col-sm-5 p-info">考试时长：
                                <span id="duration" class="sp-clr-blue"></span>
                            </p>

                            <p class="p-info col-lg-7 col-md-7 col-sm-7 ">
                                考试人数：
                                <span id="renshu" class="sp-clr-blue"></span>
                            </p>
                            <div class="col-lg-5 col-md-5 col-sm-5 p-info padding-7-0 ">
                                <button class="btn-bdr col-lg-4 col-md-4 col-sm-4 btn btn-default" style="width:120px;"
                                        data-toggle="modal" data-target="#checkStudent">
                                    <span class="glyphicon glyphicon-cog"></span>
                                    <span class="sp-clr-link-blue">查看人员</span>
                                </button>
                            </div>
                            <p class="plast-info col-lg-12 col-md-12 col-sm-12">
                                考试地点：
                                <span id="address" class="sp-clr-blue"></span>
                            </p>
                        </div>
                        <div class=" examorg-right col-lg-2 col-md-2 col-sm-2 padding-right-0">
                            <img class="col-lg-12 col-md-12 col-sm-12 padding-10"
                                 src="<%=path%>/static/images/practice/graduation22.png"/>
                        </div>
                    </div>
                </div>
                <div class=" padding-left-ringt30 padding-0 ">
                    <p class="p-font-weight col-lg-12 col-md-12 col-sm-12 padding-20-0-5 ">试卷信息：</p>
                    <div class="bdr col-lg-12 col-md-12 col-sm-12 padding-right-0 marginbtn20">
                        <div class="examorg-left col-lg-10 col-md-10 col-sm-10">
                            <p class="col-lg-7 col-md-7 col-sm-7 p1-info">考试试卷：
                                <span id="paperName" class="sp-clr-blue"></span>
                            </p>

                            <div class="col-lg-3 col-md-3 col-sm-3  padding-5-0 p-info">
                                <button class="btn-bdr col-lg-10 col-md-10 col-sm-10 btn btn-default"
                                        style="width:120px;" onclick="questionsView()">
                                    <span class="glyphicon glyphicon-eye-open"></span>
                                    <span class="sp-clr-link-blue">试题预览</span>
                                </button>
                            </div>
                            <p class="col-lg-12 col-md-12 col-sm-12 p-info">对应题库：
                                <span id="depository" class="sp-clr-blue"></span>
                            </p>
                            <p class="col-lg-7 col-md-7 col-sm-7 plast-info">题目数量：
                                <span id="questionCount" class="sp-clr-blue"></span>
                            </p>
                            <p class="col-lg-5 col-md-5 col-sm-5 plast-info">试卷分值：
                                <span id="score" class="sp-clr-blue"></span>
                            </p>
                        </div>
                        <div class=" examorg-right col-lg-2 col-md-2 col-sm-2 padding-right-0">
                            <img class="col-lg-12 col-md-12 col-sm-12 padding-10"
                                 src="<%=path%>/static/images/practice/examorgimg.png"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--
            作者：306794978@qq.com
            时间：2016-06-27
            描述：第四步结束
        -->
        <div class="stypebox">
            <div class=" form-submit floatleft" id="but">
                <div id="stypeback" class="btn btn-default  margintopbom ">
                    <i class="glyphicon glyphicon-arrow-left  lineheightx" style="margin-left:0;"></i> <span class="">上一步</span>
                </div>
            </div>
            <div class="form-submit floatrit">
                <div id="validation" class="btn btn-info margintopbom">
                    <span style="color: #FFFFFF">下一步 </span> <span class="glyphicon glyphicon-arrow-right  lineheightx"
                                            style="margin-right:0; color: #FFFFFF"></span>
                </div>
            </div>
        </div>
        <!-- 模态弹出窗 -->
        <div class="modal fade" id="checkStudent">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                                class="sr-only">Close</span></button>
                        <h4 class="modal-title">考生列表</h4>
                    </div>
                    <div class="modal-body">
                        <div id="exmainee"></div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" style="height:34px;" data-dismiss="modal">关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
        <div class="modal fade" id="paperInfo">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                                class="sr-only">Close</span></button>
                        <h4 class="modal-title">模态弹出窗标题</h4>
                    </div>
                    <div class="modal-body">
                        <p>模态弹出窗主体内容</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" style="height:34px;" data-dismiss="modal">关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <!-- 试卷模态框（Modal） -->
        <div class="modal fade" id="myModalx" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog" role="document" style="width: 1080px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel">
                            试题预览
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div>
                            <div style="width: 100%;">
                                <h4>一、单选题</h4>
                                <div id="singleList">
                                </div>
                            </div>

                            <div>
                                <h4>二、多选题</h4>
                                <div id="mutiList">
                                </div>
                            </div>
                            <div>
                                <h4>三、判断题</h4>
                                <div id="judgeList">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </div>
</div>

<!--body end-->
<script type="text/javascript" src="<%=path%>/static/js/examMng/datetime.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/examMng/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/examMng/jquery-ui-timepicker-zh-CN.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/examMng/jquery.ztree.core.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/jquery.selectlist.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/global.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/tooltip.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/examMng/common.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/examMng/exam-org-add-exam.js?2"></script>
<script type="text/javascript" src="<%=path%>/static/js/bootstrap-table.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/bootstrap-table-zh-CN.js"></script>

<script type="text/javascript">
    var zNodes = ${units};
    var titleType = 0;
    //select下拉框模拟
    $(function () {

        $('#jiankong').selectlist({
            zIndex: 10,
            height: 60,
            onChange: null
        });

        $('#examway').selectlist({
            zIndex: 10,
            height: 60,
            onChange: null
        });
        var myArray=new Array()
        myArray.push('${paperId}');
        $('#table').bootstrapTable("checkBy",{field: 'id', values:myArray});
    });
    $('#table').bootstrapTable({
        "pagination": true,
        "search": true,
        method: 'post',
        dataType: 'json',
        contentType: "application/x-www-form-urlencoded",
        url: '<%=basePath %>exam/paperList',
        striped: false,
        toolbar: "#toolbar",
        showHeader: true,
        //是否启用排序
        sortable: true,
        //排序方式
        sortOrder: "desc",
        pageNumber: 1,
        showRefresh: true,                  //是否显示刷新按钮
        pageSize: 5,                     //每页的记录行数（*）
        pageList: [5, 10, 15, 20],        //可供选择的每页的行数（*）
        clickToSelect: true,
        columns: [{
            field: 'number',
            title: '序号',
            radio: 'true',
            align: "center",
            valign: "middle"
        }, {
            field: 'title',
            title: '试卷名称',
            align: "center",
            valign: "middle"
        }, {
            field: 'questionCount',
            title: '题量',
            align: "center",
            valign: "middle",
        }, {
            field: 'score',
            title: '总分',
            align: "center",
            valign: "middle",
        }, {
            field: 'updatetime',
            title: '发布日期',
            align: "center",
            valign: "middle"
        }, {
            field: 'creater',
            title: '创建人',
            align: "center",
            valign: "middle"
        }, {
            field: 'useCount',
            title: '使用次数',
            align: "center",
            valign: "middle"
        }]
    });

    function change() {
        var proId = $("#pro").val();
        $.ajax({
            type: "POST",
            url: "<%=basePath %>depository/getRanksByPro",
            data: {"proId": proId},
            success: function (data) {
                if (data.status == 1) {
                    var rankArr = data.rankList;
                    //清空
                    $("#rank").find("option").remove();
                    //将要显示的内容展现
                    $("#rank").append("<option value='0'>请选择级别</option>");
                    for (var i = 0; i < rankArr.length; i++) {
                        $("#rank").append("<option value='" + rankArr[i].id + "'>" + rankArr[i].name + "</option>");
                    }
                }
            }
        })
    }

    var list = [];
    $(function () {
        // $('#topMain').children().eq(6).addClass('active'); // 追加样式;

        //考试管理
        if (${role eq 'master'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else if (${role eq 'trainee'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else {
            $('#topMain').children().eq(5).addClass('active'); // 追加样式;
            // $('#topMain').children().eq(5).children().attr('href', '#');
        }

        //重置按钮
        $("#allchoosedel").click(function () {
            list.length = 0;
        })

        $("#treeDemo").click(function () {
            var zTreeOjb = $.fn.zTree.getZTreeObj("treeDemo");  //ztree的Id  zTreeId
            var selectedNodes = zTreeObj.getSelectedNodes();
            var unitId = "";
            var unitName = "";
            if (selectedNodes) {
                unitId = selectedNodes[0].id;
                unitName = selectedNodes[0].name;
            }
            var liStr = "";
            $.ajax({
                type: "post",
                data: {"rankId": rank, "proId": pro, "unitId": unitId},
                url: "findUser",
                success: function (users) {
                    for (var i = 0; i < users.length; i++) {
                        if (list.indexOf(users[i].id) != -1) {
                            liStr += '<li id="check" delids="nonn" class="primary" value="' + users[i].id + '">' +
                                '<input  type="hidden" class="checkboxclick" checked="checked" name="userName" id="' + users[i].id + '" value="' + users[i].name + '(' + unitName + ')' + '" />' +
                                '<span id="pers" class="sp-algn-left">' + users[i].name
                            '</span>'
                            '</li>'
                        } else {
                            liStr += '<li id="check" delids="nonn" class="primary" value="' + users[i].id + '">' +
                                '<input  type="hidden" class="checkboxclick" name="userName" id="' + users[i].id + '" value="' + users[i].name + '(' + unitName + ')' + '" />' +
                                '<span id="pers"  class="sp-algn-left">' + users[i].name
                            '</span>'
                            '</li>'
                        }
                    }
                    $("#kaosheng").html(liStr);

                    $("li[class=primary]").click(function () {
                        var v = $(this).val()
                        if (list.indexOf(v) != -1) {
                            var index = list.indexOf(v);
                            list.splice(index, 1);
                        } else {
                            list.push(v)
                        }
                    })
                }
            })
        })
    })
    function questionsView () {
        $.ajax({
            type: "POST",
            url: "questionsView",
            data: {
                "examId": examId,
                "paperId": paperId
            },
            success: function (data) {

                var singleList = data.singleList;
                var mutiList = data.mutiList;
                var judgeList = data.judgeList;
                var count = 1;
                for (var x = 0; x < singleList.length;x++){
                    let  strDiv = " <div><div class=\"div-title\"><b>"+count+".</b>"+singleList[x].title+"</div>" ;
                    let titlePic = "";
                    if(singleList[x].picture!="") {
                        titlePic = "<img style=\"width: 200px;height: 250px;\" src=\""+singleList[x].picture+"\"/></br>";
                    }
                    let optionA = "";
                    if(singleList[x].apic!="") {
                        optionA = "<div class=\"div-pic\"><b>A.&nbsp;</b>" +singleList[x].a
                                +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+singleList[x].apic+"\"/></div>"+
                              "</div>"
                    } else {
                        optionA = "<div class=\"div-pic\"> <b>A.&nbsp;</b>"+singleList[x].a + "</div>\n"
                    }
                    let optionB = "";
                    if(singleList[x].bpic!="") {
                        optionB = "<div class=\"div-pic\"><b>B.&nbsp;</b>" +singleList[x].b
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+singleList[x].bpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionB =  "<div class=\"div-pic\"> <b>B.&nbsp;</b>"+singleList[x].b+"</div>\n";
                    }
                    let optionC = "";
                    if(singleList[x].cpic!="") {
                        optionC = "<div class=\"div-pic\"><b>C.&nbsp;</b>" +singleList[x].c
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+singleList[x].cpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionC = "<div class=\"div-pic\"> <b>C.&nbsp;</b>"+singleList[x].c+"</div>";
                    }
                    let optionD = "";
                    if(singleList[x].dpic!="") {
                        optionD = "<div><b>D.&nbsp;</b>" +singleList[x].d
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+singleList[x].dpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionD = "<div> <b>D.&nbsp;</b>"+singleList[x].d+"</div>";
                    }
                    let answer = "<div class=\"div-answer\">正确答案：<b>"+singleList[x].answer+"</b></div>"
                    let singleDiv = strDiv + titlePic
                        + optionA+ optionB+ optionC+ optionD
                        +answer;
                    $("#singleList").append(singleDiv)
                    count++;
                }
                for (var x = 0; x <mutiList.length ; x++) {
                    let  strDiv = " <div><div class=\"div-title\"><b>"+count+".</b>"+mutiList[x].title+"</div>" ;
                    let titlePic = "";
                    if(mutiList[x].picture!="") {
                        titlePic = "<img style=\"width: 200px;height: 250px;\" src=\""+mutiList[x].picture+"\"/></br>";
                    }
                    let optionA = "";
                    if(mutiList[x].apic!="") {
                        optionA = "<div class=\"div-pic\"><b>A.&nbsp;</b>" +mutiList[x].a
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+mutiList[x].apic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionA = "<div class=\"div-pic\"> <b>A.&nbsp;</b>"+mutiList[x].a + "</div>\n"
                    }
                    let optionB = "";
                    if(mutiList[x].bpic!="") {
                        optionB = "<div class=\"div-pic\"><b>B.&nbsp;</b>" +mutiList[x].b
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+mutiList[x].bpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionB =  "<div class=\"div-pic\"> <b>B.&nbsp;</b>"+mutiList[x].b+"</div>\n";
                    }
                    let optionC = "";
                    if(mutiList[x].cpic!="") {
                        optionC = "<div class=\"div-pic\"><b>C.&nbsp;</b>" +mutiList[x].c
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+mutiList[x].cpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionC = "<div class=\"div-pic\"> <b>C.&nbsp;</b>"+mutiList[x].c+"</div>";
                    }
                    let optionD = "";
                    if(mutiList[x].dpic!="") {
                        optionD = "<div><b>D.&nbsp;</b>" +mutiList[x].d
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+mutiList[x].dpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionD = "<div> <b>D.&nbsp;</b>"+mutiList[x].d+"</div>";
                    }
                    let answer = "<div class=\"div-answer\">正确答案：<b>"+mutiList[x].answer+"</b></div>"
                    let mutiDiv = strDiv + titlePic
                        + optionA+ optionB+ optionC+ optionD
                        +answer;
                    $("#mutiList").append(mutiDiv);
                    count++;
                }
                for (var x = 0; x < judgeList.length; x++) {
                    let  strDiv = " <div><div class=\"div-title\"><b>"+count+".</b>"+judgeList[x].title+"</div>" ;
                    let titlePic = "";
                    if(judgeList[x].picture!="") {
                        titlePic = "<img style=\"width: 200px;height: 250px;\" src=\""+judgeList[x].picture+"\"/></br>";
                    }
                    let optionA = "";
                    if(judgeList[x].apic!="") {
                        optionA = "<div class=\"div-pic\"><b>A.&nbsp;</b>" +judgeList[x].a
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+judgeList[x].apic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionA = "<div class=\"div-pic\"> <b>A.&nbsp;</b>"+judgeList[x].a + "</div>\n"
                    }
                    let optionB = "";
                    if(judgeList[x].bpic!="") {
                        optionB = "<div><b>B.&nbsp;</b>" +judgeList[x].b
                            +"<div><img style=\"width: 200px;height: 250px;\"  src=\""+judgeList[x].bpic+"\"/></div>"+
                            "</div>"
                    } else {
                        optionB =  "<div> <b>B.&nbsp;</b>"+judgeList[x].b+"</div>\n";
                    }

                    let answer = "<div class=\"div-answer\">正确答案：<b>"+judgeList[x].answer+"</b></div>"
                    let judgeDiv = strDiv + titlePic
                        + optionA+ optionB
                        +answer;
                    $("#judgeList").append(judgeDiv);
                    count++;
                }
                $('#myModalx').modal("show");
            }
        })
    }

</script>
</body>
</html>